package com.company.OfferGuide;

import java.util.Arrays;

public class 最小的k个数 {

    public static void main(String[] args) {

    }

    public int[] getLeastNumbers(int[] arr, int k) {
        if (arr == null || arr.length == 0) return new int[]{};
        if (k > arr.length) return new int[]{};
        Arrays.sort(arr);
        return Arrays.copyOfRange(arr,0,k);

    }

}
